/**
 * @Author 86152
 * @create 2024/4/1 11:33
 */

import jakarta.servlet.*;
import jakarta.servlet.http.*;
import jakarta.servlet.annotation.*;

import java.io.IOException;

@WebServlet("/f")
public class ServletF extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 获取或创建一个新的会话
        HttpSession session = request.getSession(true);
        System.out.println(session.getId());
        String s1 = (String) session.getAttribute("s1");
        System.out.println(s1);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}